package com.cupdata.zicon.thrift.client.pool;

import org.apache.thrift.TServiceClient;

public class ThriftClientKey {
    private Class<? extends TServiceClient> clazz;
    private String serviceName;
    private String serviceId;
    
    
	public ThriftClientKey(Class<? extends TServiceClient> clazz, String serviceName, String serviceId) {
		super();
		this.clazz = clazz;
		this.serviceName = serviceName;
		this.serviceId = serviceId;
	}
	public Class<? extends TServiceClient> getClazz() {
		return clazz;
	}
	public void setClazz(Class<? extends TServiceClient> clazz) {
		this.clazz = clazz;
	}
	public String getServiceName() {
		return serviceName;
	}
	public void setServiceName(String serviceName) {
		this.serviceName = serviceName;
	}
	public String getServiceId() {
		return serviceId;
	}
	public void setServiceId(String serviceId) {
		this.serviceId = serviceId;
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((clazz == null) ? 0 : clazz.hashCode());
		result = prime * result + ((serviceId == null) ? 0 : serviceId.hashCode());
		result = prime * result + ((serviceName == null) ? 0 : serviceName.hashCode());
		return result;
	}
	
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ThriftClientKey other = (ThriftClientKey) obj;
		if (clazz == null) {
			if (other.clazz != null)
				return false;
		} else if (!clazz.equals(other.clazz))
			return false;
		if (serviceId == null) {
			if (other.serviceId != null)
				return false;
		} else if (!serviceId.equals(other.serviceId))
			return false;
		if (serviceName == null) {
			if (other.serviceName != null)
				return false;
		} else if (!serviceName.equals(other.serviceName))
			return false;
		return true;
	}

    
}
